package model.map{
	import flash.display.*;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.*;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	import mx.controls.*;
	
	import spark.components.Button;
	
	public class SpriteWindow extends Sprite
	{
		private var textField:TextField;
		public var buttonDetail:ButtonAsset;
		public var buttonCancel:ButtonAsset;
		private var infoWindowBg:DisplayObject;
		
		[Bindable]
		[Embed('assets/component.swf', symbol='InfoWindowBg')]
		private static var InfoWindowBg:Class;
		
		public function SpriteWindow()
		{
			infoWindowBg = new InfoWindowBg();		
			buttonDetail = new ButtonAsset();
			buttonCancel = new ButtonAsset();
			textField = new TextField();
			
			buttonDetail.text = "Detail";
			buttonDetail.x = 4;
			buttonDetail.y = infoWindowBg.height - 52;
			
			buttonCancel.text = "Cancel";
			buttonCancel.x = buttonDetail.width + 10;
			buttonCancel.y = infoWindowBg.height - 52;
			
			addChild(infoWindowBg);
			addChild(buttonDetail);
			addChild(buttonCancel);
		}	
		
		public function set text(value:String):void
		{
			if(!contains(textField))
			{			
				textField.selectable = false;
				textField.multiline = true;
				textField.wordWrap = true;			
				
				var borderSize:int = 4;
				textField.x = borderSize;
				textField.y = borderSize;
				textField.width = width;
				textField.height = height - 60;
				
				addChild(textField);
			}
			
			textField.text = value;
			
			var header:TextFormat = new TextFormat();
			header.color = 0xFFFFFF;
			header.size = 16;
			header.font = "Arial";
			header.bold = false;
			textField.setTextFormat(header);
		}
		
		public function getOffsetX():Number
		{
			return (-87);
		}
		
		public function getOffsetY():Number
		{
			return (-173);
		}
	
	}
}